Recording Actions in the Finder
You can record almost any actions in the Finder that involve manipulating Finder windows or icons: for example, opening folders, copying files, or changing View settings. To record actions in the Finder, click the Record button in the Script Editor application, then activate the Finder (by clicking on the desktop or choosing Finder from the Applications menu) and perform the actions that you want to record.For example, suppose you like to have certain Finder windows arranged next to each other on the desktop when you're working on financial matters, so
that related files, alias files, or applications are easily accessible. To record the arrangement you want, follow these steps:
The recorded script should look something like the one in Listing 1-1 on page 5.
- Open the Script Editor application.
- Click the Record button.
- Activate the Finder by clicking on the desktop or choosing Finder from the Applications menu.
- If any Finder windows are currently open, close them all by holding down the Option key and clicking the close box of the active window.
- Open, resize, and arrange the windows whose positions you want
to record.- When you're satisfied with the arrangement of the desktop, activate the Script Editor again and click the Stop button.
If you save your recorded script as a script application, you can arrange the windows the same way at any time by double-clicking the script's icon in the Finder. The Finder responds by closing any windows that are currently open and opening and arranging windows as specified in the script.
Listing 1-1 A sample recorded script
tell application "Finder" activate close every window select startup disk open selection set position of window of startup disk to {4, 43} set size of window of startup disk to {369, 464} select folder "Financial" of startup disk open selection set position of window of folder "Financial" of startup disk to ¬ {378, 43} set size of window of folder "Financial" of startup disk to ¬ {200, 155} select folder "Letters" of startup disk open selection set size of window of folder "Letters" of startup disk to ¬ {257, 385} set position of window of folder "Letters" of startup disk to ¬ {379, 222} set size of window of folder "Letters" of startup disk to ¬ {200, 286} end tell
Subtopics
- Modifying Recorded Scripts
- Simplifying Recorded Scripts